#include <stdio.h>
#include "ofc/DKey.h"

int main(int argc, char *argv[])
{
  DKey  *key1 = [DKey alloc];
  DKey  *key2 = [DKey new  ];
  DText *str;

  [key1 init :DKEY_ESCAPE];            // Init with the escape key

                                       // Check for control key
  printf("Key1 %s a control key.\n", ([key1 isCtrlKey] ? "is" : "is not"));

  str = [key1 toText];                 // Convert the key to string description
  printf("Key1 description: %s.\n", [str cstring]);
  [str free];


  [key2 set :DKEY_DELETE|DKEY_MOD_CTRL|DKEY_MOD_ALT]; // Set the key to Ctrl-Alt-Del

  printf("Key2 %s a control key.\n", ([key2 isCtrlKey ] ? "is" : "is not"));
  printf("Key2 %s a shift key.\n",   ([key2 isShiftKey] ? "is" : "is not"));
  printf("Key2 %s a alt key.\n",     ([key2 isAltKey  ] ? "is" : "is not"));

  str = [key2 toText];                 // Convert the key to string description
  printf("Key2 description:%s.\n", [str cstring]);
  [str free];

  [key1 free];                         // Cleanup
  [key2 free];
  
  return 0;
}

